package com.easylinkin.linkappapi.function.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.easylinkin.linkappapi.function.entity.FunctionRefPrivilege;
import com.easylinkin.linkappapi.function.entity.FunctionRefTenant;
import com.easylinkin.linkappapi.function.entity.LinkappFunction;
import com.easylinkin.linkappapi.security.entity.LinkappPrivilege;
import com.easylinkin.linkappapi.tenant.entity.LinkappTenant;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author liuming
 * @since 2020-05-16
 */
public interface LinkappFunctionMapper extends BaseMapper<LinkappFunction> {

    List<LinkappFunction> getLinkappFunctions(Page<LinkappFunction> page, @Param("function") LinkappFunction function);

    List<LinkappFunction> getLinkappFunctions(@Param("function") LinkappFunction function);

    LinkappFunction getLinkappFunction(LinkappFunction function);
    
    List<LinkappPrivilege> selectPrivilegeByFunction(@Param("id") String id);

	void deleteFunction2Privileges(@Param("id") String id);

	void insertFunction2Privileges(FunctionRefPrivilege functionRefPrivilege);
	
	void deleteFunctions2Tenant(@Param("id") String id);
	
	void insertFunctions2Tenant(FunctionRefTenant functionRefTenant);
	
	List<LinkappTenant> selectTenantByFunction(@Param("functionId") String functionId);

	/***
	 * 根据功能标识所需获取设备类型
	 * @param identifier 功能标识，例如：air_conditioner
	 * @param tenantId 租户ID
	 * @return
	 */
	List<Map<String,String>> getFunacionDeviceTypeByIdentifier(@Param("identifier") String identifier,@Param("tenantId") String tenantId);
	
 }
